<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"
	trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="../admin.inc.jsp"%>
<script>
	function toSubmit() {		
		var obj = $("#upload");
		var form = $("#form_indexRecom_add");
		form.submit();
	}
	function callback(success, msg) {
		if (success) {
			alertMsg.info(msg);
			navTab.closeCurrentTab();		
			navTab.reload("", {
				lastTabId : ""
			});
		}else{
			alertMsg.warn(msg);
		}
	}
	
</script>
<div class="pageContent">
	<s:form name="myForm" id="form_indexRecom_add" action="/admin/indexRecom/add"
		method="POST" enctype="multipart/form-data" target="hidden_frame">
		<div class="pageFormContent" layoutH="58">
			<p class="nowrap">
				<label>城市：</label>
				<select id = "cityCode" name="indexRecom.cityCode" class="required">
					<c:forEach var="item" items="${cityCodeList}">
		            	<option value="${item.configValue}" >${item.description}</option>
		            </c:forEach>
				</select>
			</p>
			
			<p class="nowrap">
				<label>模特：</label>
				<input id="modelId1"  type="hidden" name="indexRecom.modelId" >
				<input id="modelId" type="hidden"  name="model.id"  value="">
				<input id="coverImage"  type="hidden" name="model.coverImage"  value="">
				<input id="modelName" type="text" class="textInput valid" name="model.name" value="" readonly="readonly"
				 suggesturl="${webContextPath}/admin/modelPickup/pickup" lookupgroup="model" autocomplete="off" >
				<a class="btnLook" href="${webContextPath}/admin/modelPickup/pickup" lookupgroup="model"  callback="lookup_callback">查找带回</a>		
			</p>
			
			<p class="nowrap">
				<label style="width:80px;">&nbsp;</label> 
				 <input type="file" name="image"
					id="image" />
			</p>
			
			<p style='height:60px; '>
				<label style="width:80px;">推荐位图片：</label> 
				 <img id="imageUrl"  name="imageUrl" alt="" src=""  style='height:60px; border: 1px solid silver;'>
			</p>
			
			<p class="nowrap">
				<label>显示顺序：</label>
				<input type="text" name="indexRecom.orderIndex" >
			</p>
			
			<p>
				<label>到达开始时间</label>	
				<input id="arriveStartTime"  class="Wdate" type="text"  name="indexRecom.arriveStartTime" 
				onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="true">
				<a class="inputDateButton" style="float:right; "  href="javascript:;">选择</a>
			</p>
			
			<p>
				<label>到达结束时间</label>	
				<input id="arriveEndTime"  class="Wdate" type="text"  name="indexRecom.arriveEndTime" 
				 onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="true">
				<a class="inputDateButton" style="float:right; "  href="javascript:;">选择</a>
			</p>
		</div>
	</s:form>
	<div class="formBar">
		<ul>
			<li><div class="button">
					<div class="buttonContent">
						<button onclick="toSubmit()" type="button">确定</button>
					</div>
				</div></li>
			<li><div class="button">
					<div class="buttonContent">
						<button type="button" class="close">关闭</button>
					</div>
				</div></li>
		</ul>
	</div>
</div>
<iframe name='hidden_frame' id="hidden_frame" style='display: none'></iframe>
<script language="javascript">
function lookup_callback() {
	var modelId = $("#modelId").val();
	$('#modelId1').val(modelId);
	var coverImage = $("#coverImage").val();
	$("#imageUrl").attr("src","${webUrl}"+coverImage);
}
</script>